<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 假设有n阶楼梯 每次可以上一个或者两个 有多少种上法
      function climb(n) {
        // 当有几个台阶的时候会有几种方法
        const dp = [0, 1, 2]
        for (let i = 3; i <= n; i++) {
          dp[i] = dp[i - 1] + dp[i - 2]
        }
        console.log(dp[n])
      }
      climb(20)
    </script>
  </body>
</html>
